<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  console.log(1);
  async function async(){
    console.log(2);

    //Promise.resolve(console.log(3)).then(()=>{console.log(4)})
    await console.log(3)
    console.log(4);
  }

  setTimeout(() => {
    console.log(5);
  },0);

  const promise = new Promise(((resolve, reject) => {
    console.log(6);
    resolve(7);
  }));
  promise.then(res => {
    console.log(res);
  });
  async(); //里面的代码会同步执行
  console.log(8);

  //微任务队列 [7,4]
  //1 6 2 3 8 7 4 5
</script>
</body>
</html>
